summaryrefslogtreecommitdiff
path: root/app/[lng]/evcp/(evcp)/avl/page.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'app/[lng]/evcp/(evcp)/avl/page.tsx')
-rw-r--r--app/[lng]/evcp/(evcp)/avl/page.tsx49
1 files changed, 49 insertions, 0 deletions
diff --git a/app/[lng]/evcp/(evcp)/avl/page.tsx b/app/[lng]/evcp/(evcp)/avl/page.tsx
new file mode 100644
index 00000000..a5a5a170
--- /dev/null
+++ b/app/[lng]/evcp/(evcp)/avl/page.tsx
@@ -0,0 +1,49 @@
+import * as React from "react"
+import { type SearchParams } from "@/types/table"
+import { getValidFilters } from "@/lib/data-table"
+import { vendorPoSearchParamsCache } from "@/lib/po/vendor-table/validations"
+import { getAvlLists } from "@/lib/avl/service"
+import { AvlListItem } from "@/lib/avl/types"
+import { AvlPageClient } from "./avl-page-client"
+
+interface AvlPageProps {
+ searchParams: Promise<SearchParams>
+}
+
+// 서버에서 초기 데이터 로드
+async function getInitialAvlData(searchParams: SearchParams) {
+ try {
+ const search = vendorPoSearchParamsCache.parse(searchParams)
+ const validFilters = getValidFilters(search.filters)
+
+ // 기본 파라미터로 전체 데이터 조회
+ const result = await getAvlLists({
+ page: 1,
+ perPage: 100, // 충분한 수량으로 조회
+ sort: [{ id: "createdAt", desc: true }],
+ flags: [],
+ filters: validFilters,
+ joinOperator: "and",
+ search: search.search || "",
+ isTemplate: "" as any,
+ constructionSector: "",
+ projectCode: "",
+ shipType: "",
+ avlKind: "",
+ htDivision: "" as any,
+ rev: "",
+ })
+
+ return result.data
+ } catch (error) {
+ console.error("AVL 초기 데이터 로드 실패:", error)
+ return []
+ }
+}
+
+export default async function AvlPage(props: AvlPageProps) {
+ const searchParams = await props.searchParams
+ const initialData = await getInitialAvlData(searchParams)
+
+ return <AvlPageClient initialData={initialData} />
+}